package com.example.demo.controller.dxy;

import com.example.demo.entity.User;
import com.example.demo.service.dxy.IUserService;
import com.example.demo.service.dxy.IHomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author:daixiaoyi
 */

@Slf4j
@Api("课程管理")
@RestController
public class HomeController {
    @Autowired
    IHomeService iHomeService;
    @RequestMapping(value = "/findHomeAll",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "全查2")
    public List<User> findHomeAll(){
        List<User> allUser = iHomeService.findHomeAll();
        return allUser;
    }
    @ResponseBody
    @RequestMapping(value = "/addHome",method = RequestMethod.POST)
    @ApiOperation(value = "增加2")
    public int addHomeInfo(String id,String username,String password,String birthday,String photo,String introduce,String usertype){
        int addHomeInfo =iHomeService.addHomeInfo(id,username,password,birthday,photo,introduce,usertype);
        return addHomeInfo;

    }
    @ResponseBody
    @RequestMapping(value = "/deleteHome",method = RequestMethod.POST)
    @ApiOperation(value = "删除2")
    public int deleteHomeInfo(String id){
        int deleteHomeInfo=iHomeService.deleteHomeInfo(id);
        return deleteHomeInfo;

    }
    @ResponseBody
    @RequestMapping(value = "/updeteHome",method = RequestMethod.POST)
    @ApiOperation(value = "修改2")
    public int updeteHomeInfo(String id,String username,String password,String birthday,String photo,String introduce,String usertype) {
        int updeteHomeInfo = iHomeService.updeteHomeInfo(id,username,password,birthday,photo,introduce,usertype);
        return updeteHomeInfo;
    }
}
